Reduce TLB flushes:
1. When we update the cr3 during VMRUN/VMEXIT emulation
we toggle between n1asid and n2asid forth and back
=> no TLB flush needed
2. Only flush n1asid or n2asid depending on vcpu guest mode
and not both unconditionally.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
if ( !nestedhvm_enabled(v->domain) )
hvm_asid_flush_vcpu(v);
else if ( nestedhvm_vmswitch_in_progress(v) )
- ; /* We toggle between n1asid/n2asid -> no flush required. */
+ ; /* CR3 switches during VMRUN/VMEXIT do not flush the TLB. */
else
hvm_asid_flush_vcpu_asid(
nestedhvm_vcpu_in_guestmode(v)